package com.slz3.business.module.afterSaleManagement.aftApplyOrder.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.afterSaleManagement.aftApplyOrder.domain.AftApplyOrder;
import com.slz3.business.module.afterSaleManagement.aftApplyOrder.domain.AftApplyOrderFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class AftApplyOrderTransactionalServiceImpl implements AftApplyOrderTransactionalService {

    @Override
    public AftApplyOrder modify(AftApplyOrder aftApplyOrderNew) {
        Repositorys.aftApplyOrder.test();
        Repositorys.aftApplyOrder.save(AftApplyOrderFactory.initBaseFields());
        System.err.println(1/0);
        aftApplyOrderNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.aftApplyOrder.saveAndFlush(aftApplyOrderNew);
    }

    @Override
    public List<AftApplyOrder> batchModify(List<AftApplyOrder> aftApplyOrderList) {
        return Repositorys.aftApplyOrder.saveAll(aftApplyOrderList);
    }
}
